//
//  BaseLoReController.m
//  pmmSS
//
//  Created by Mac book on 2017/9/5.
//  Copyright © 2017年 WTFSSD. All rights reserved.
//

#import "BaseLoReController.h"

@interface BaseLoReController ()

@property(nonatomic,strong)UIView *lineView;

@end

@implementation BaseLoReController

- (void)viewDidLoad {
    
    [super viewDidLoad];

     self.view.backgroundColor = HexColor(0x489DF5);

    [self createLogoImage];
    [self createLabel];
    [self createTextField];
    [self creataBtn];


    // Do any additional setup after loading the view.
}
-(void)createLogoImage{

    WeakSelf(weakSelf);


    //375  667
    _logoImage = [[UIImageView alloc]init];
    self.logoImage.backgroundColor = [UIColor clearColor];
    [self.logoImage setImage:[UIImage imageNamed:@"icon_logo"]];

    [self.view addSubview:_logoImage];

    [_logoImage mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(GET_FRAME_HEIGHT(weakSelf.view)*0.09);
        make.width.mas_equalTo(autoScaleW(142));
        make.height.mas_equalTo(autoScaleH(142));
        
    }];
    
}
//---------------

-(void)createLabel{

    WeakSelf(weakSelf);

    //------------**********------------
    _userLabel = [HMLabel createLabelWithText:@"" andTextColor:[UIColor whiteColor] andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(18)] andTextAlignment:NSTextAlignmentLeft];

    [self.view addSubview:_userLabel];

    [_userLabel mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(10);
        make.top.equalTo(weakSelf.logoImage.mas_bottom).offset(autoScaleH(40));
        make.width.mas_equalTo(autoScaleW(80));
        make.height.mas_equalTo(autoScaleH(50));

    }];

    //------------**********------------

    _passwordLabel = [HMLabel createLabelWithText:@"" andTextColor:[UIColor whiteColor] andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(18)] andTextAlignment:NSTextAlignmentLeft];

    [self.view addSubview:_passwordLabel];

    [_passwordLabel mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(10);
        make.top.equalTo(weakSelf.userLabel.mas_bottom).offset(2);
        make.width.mas_equalTo(autoScaleW(80));
        make.height.mas_equalTo(autoScaleH(50));

    }];

    //划线
    //------------**********------------
    //NSLog(@"userLabel--y === %f",_userLabel.frame.origin.y);

    for (int i = 0; i < 2; i++) {

        _lineView = [[UIView alloc] init];

        _lineView.backgroundColor = View_BackgroundColor;

        [self.view addSubview:_lineView];


        [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {

            make.left.mas_equalTo(10);
            make.top.equalTo(weakSelf.userLabel.mas_bottom).offset(0.5 + autoScaleH(52)*i);
            make.width.mas_equalTo(GET_FRAME_WIDTH(weakSelf.view)-10);
            make.height.mas_equalTo(0.5);

        }];


    }

}


-(void)createTextField{


    WeakSelf(weakSelf);
    //------------**********------------
    _userNameTextfield = [HMTextField createTextFieldWithText:@"" andpLlaceholder:@"哈哈哈" andTextColor:[UIColor whiteColor] andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(18)] andTextAlignment:NSTextAlignmentLeft andTextFieldViewMode:UITextFieldViewModeWhileEditing];

    [_userNameTextfield setValue:RGBA(255, 255, 255, 0.5) forKeyPath:@"_placeholderLabel.textColor"];


    [self.view addSubview:_userNameTextfield];

    [_userNameTextfield mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(weakSelf.userLabel.mas_right).offset(autoScaleW(8));

        make.top.equalTo(weakSelf.logoImage.mas_bottom).offset(autoScaleH(40));
        make.width.mas_equalTo(autoScaleW(175));
        make.height.mas_equalTo(autoScaleH(50));

    }];
    //------------**********------------
    _passWordTextfield = [HMTextField createTextFieldWithText:@"" andpLlaceholder:@"哈哈哈" andTextColor:[UIColor whiteColor] andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(18)] andTextAlignment:NSTextAlignmentLeft andTextFieldViewMode:UITextFieldViewModeWhileEditing];

    [_passWordTextfield setValue:RGBA(255, 255, 255, 0.5) forKeyPath:@"_placeholderLabel.textColor"];

    [self.view addSubview:_passWordTextfield];
    [_passWordTextfield mas_makeConstraints:^(MASConstraintMaker *make) {


        make.left.mas_equalTo(weakSelf.userLabel.mas_right).offset(autoScaleW(8));
        make.top.equalTo(weakSelf.userNameTextfield.mas_bottom).offset(2);
        make.width.mas_equalTo(autoScaleW(175));
        make.height.mas_equalTo(autoScaleH(50));

    }];

}

-(void)creataBtn{

    WeakSelf(weakSelf);

    _loginBtn = [HMButton createButtonWithTitle:@"" andTitleColor:RGBA(78,159,242,1) andBgColor:[UIColor whiteColor] andImage:nil andBgImage:nil andSelecter:@selector(clickBtn:) andTarget:nil andTag:101];

    _loginBtn.titleLabel.font = [UIFont fontWithName:default_fontname size:autoScaleW(18)];
    _loginBtn.clipsToBounds = YES;
    _loginBtn.layer.cornerRadius = 4;

    [self.view addSubview:_loginBtn];

    //------------**********------------

    [_loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerX.mas_equalTo(weakSelf.view);
        make.top.equalTo(weakSelf.passwordLabel.mas_bottom).offset(autoScaleH(25));
        make.width.mas_equalTo(GET_FRAME_WIDTH(weakSelf.view)-20);
        make.height.mas_equalTo(autoScaleH(35));

    }];

    //------------**********------------

}
-(void)clickBtn:(UIButton *)button{
    

    
}


//---------------顶部导航栏 字体颜色变白
-(UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}
//键盘控制

//- (void)viewWillAppear:(BOOL)animated {
//    [super viewWillAppear:animated];
//    [IQKeyboardManager sharedManager].enable = NO;
//}
//
//- (void)viewWillDisappear:(BOOL)animated {
//
//    [super viewWillDisappear:animated];
//    [IQKeyboardManager sharedManager].enable = YES;
//    
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
